package com.ruoyi.system.rollback;

import org.apache.rocketmq.client.producer.SendCallback;
import org.apache.rocketmq.client.producer.SendResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 实现rocketMQ的成功、失败回调
 * @author zhaoYuFei
 */
public class SendCallbackImpl implements SendCallback {
    private static final Logger log = LoggerFactory.getLogger(SendCallbackImpl.class);
    private String username;

    public SendCallbackImpl() {
    }

    public SendCallbackImpl(String username) {
        this.username = username;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    @Override
    public void onSuccess(SendResult sendResult) {
        log.info(username+"信息推送成功");
    }

    @Override
    public void onException(Throwable throwable) {
        log.error(username+"信息推送失败");
    }
}
